﻿using UnityEngine;
using System.Collections;

[ExecuteInEditMode]
public class DrawLine : MonoBehaviour {
	public enum LineType{
		NOTHING,
		PICK_UP_RAY
	};
	public LineType lineType = LineType.NOTHING;
	void OnDrawGizmos(){
		switch (lineType) {
		case LineType.NOTHING:
			break;
		case LineType.PICK_UP_RAY:
			DrawPickUpRay ();
			break;
		default:
			break;
		}
	}

	Transform mCamera;
	void DrawPickUpRay(){
		Gizmos.color = Color.red;
		Ray ray = new Ray (mCamera.position, mCamera.forward);
		RaycastHit hit;
		if (Physics.Raycast (ray, out hit, 100f)) {
			Gizmos.DrawLine (ray.origin, hit.point);
		}
	}
	void Start(){
		mCamera = StaticVarFunc.PlayerEye.transform;
	}
}
